<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="itcast" uri="http://itcast.cn/common/"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="" />
<meta name="author" content="" />

<title>新建卷筒分切任务表</title>
<link href="<%=basePath%>css/bootstrap.min.css" rel="stylesheet"
	media="screen" />
<link href="<%=basePath%>css/bootstrap-datetimepicker.min.css"
	rel="stylesheet" media="screen" />
<!-- Bootstrap Core CSS -->
<link href="<%=basePath%>css/bootstrap.min.css" rel="stylesheet" />

<!-- MetisMenu CSS -->
<link href="<%=basePath%>css/metisMenu.min.css" rel="stylesheet" />

<!-- DataTables CSS -->
<link href="<%=basePath%>css/dataTables.bootstrap.css" rel="stylesheet" />

<!-- Custom CSS -->
<link href="<%=basePath%>css/sb-admin-2.css" rel="stylesheet" />

<!-- Custom Fonts -->
<link href="<%=basePath%>css/font-awesome.min.css" rel="stylesheet"
	type="text/css" />
<link href="<%=basePath%>css/boot-crm.css" rel="stylesheet"
	type="text/css" />

<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>

<body>

	<div id="wrapper">


		<!-- Navigation -->
		<nav class="navbar navbar-default navbar-static-top" role="navigation"
			style="margin-bottom: 0">
		<div class="navbar-header">
			<button type="button" class="navbar-toggle" data-toggle="collapse"
				data-target=".navbar-collapse">
				<span class="sr-only">Toggle navigation</span> <span
					class="icon-bar"></span> <span class="icon-bar"></span> <span
					class="icon-bar"></span>
			</button>
			<a class="navbar-brand" href="<%=basePath%>index.action">工单管理系统V1.0</a>
			<div class="navbar-brand">欢迎您：${sessionScope.user_login.username}</div>
		</div>
		<!-- /.navbar-header --> <!-- /.navbar-top-links -->

		<div class="navbar-default sidebar panel-collapse collapse in"
			role="navigation">
			<div class="sidebar-nav navbar-collapse">
				<ul class="nav" id="side-menu">
					<li><a href="#WorkOrderSetting"
						class="sidebar-nav navbar-collapse" data-toggle="collapse">&nbsp;&nbsp; <i
							class="fa fa-th-list fa-fw"></i> 工单管理
					</a></li>
					<ul id="WorkOrderSetting" class="nav nav-list collapse secondmenu">
						<!-- <li><a href="<%=basePath%>createWorkOrder.action">&nbsp;&nbsp;<i class="fa fa-edit fa-fw"></i> 新建工单</a></li> -->
						<li><a href="<%=basePath%>queryWorkOrder.action">&nbsp;&nbsp;<i class="fa fa-eye fa-fw"></i> 查询工单</a></li>
						<li><a href="<%=basePath%>addMissionOrder.action">&nbsp;&nbsp;<i class="fa fa-plus fa-fw"></i> 新建任务</a></li>
						<li><a href="<%=basePath%>queryMissionOrder.action">&nbsp;&nbsp;<i class="fa fa-folder-open fa-fw"></i> 查询任务</a></li>
						<li><a href="<%=basePath%>statistics.action">&nbsp;&nbsp;<i class="fa fa-line-chart fa-fw"></i> 统计数据</a></li>
					</ul>
					<li><a href="#customerSetting"
						class="sidebar-nav navbar-collapse" data-toggle="collapse">&nbsp;&nbsp;  <i
							class="fa fa-user fa-fw"></i> 员工管理
					</a></li>
					<ul id="customerSetting" class="nav nav-list collapse secondmenu">
						<li><a href="<%=basePath%>register.action">&nbsp;&nbsp;<i class="fa fa-plus fa-fw"></i> 创建员工</a></li>
						<li><a href="<%=basePath%>queryUser.action">&nbsp;&nbsp;<i class="fa fa-edit fa-fw"></i> 查询员工</a></li>
						<!-- <li><a href="#">&nbsp;&nbsp;<i class="fa fa-edit fa-fw"></i> 密码修改</a></li> -->
					</ul>
					<li><a href="#quit"
						class="sidebar-nav navbar-collapse" data-toggle="collapse">&nbsp;&nbsp;&nbsp;<i class="fa fa-remove fa-fw"></i> 账号登出
					</a></li>
					<ul id="quit" class="nav nav-list collapse secondmenu">
						<li><a href="<%=basePath%>quit.action">&nbsp;&nbsp;<i class="fa fa-remove fa-fw"></i> 退出</a></li>
					</ul>

				</ul>
			</div>
			<!-- /.sidebar-collapse -->
		</div>
		<!-- /.navbar-static-side --> </nav>

		<div id="page-wrapper">
			<div class="row">
				<div class="col-lg-12">
					<h1 class="page-header">新建卷筒分切任务表</h1>
				</div>
				<!-- /.col-lg-12 -->
			</div>

			<div class="container">
				<form id="myform" class="form-horizontal" style="margin-top: 5px;">
					<div class="row">
						<div class="form-group col-lg-6">
							<label for="gname" class="col-sm-2 control-label">商品名称</label>
							<div class="col-sm-8">
								<input type="text" class="form-control" id="gname" name="gname"
									placeholder="请输入商品名称" />
							</div>
						</div>
						<div class="form-group col-lg-6">
							<label for="grammage" class="col-sm-2 control-label">克重(克/平米)</label>
							<div class="col-sm-8">
								<input type="text" class="form-control" id="grammage" name="grammage"
									placeholder="请输入克重" />
							</div>
						</div>
						<div class="form-group col-lg-6">
							<label for="pname" class="col-sm-2 control-label">成品名称</label>
							<div class="col-sm-8">
								<input type="text" class="form-control" id="pname" name="pname"
									placeholder="请输入成品名称" />
							</div>
						</div>
						<div class="form-group col-lg-6">
							<label for="specification" class="col-sm-2 control-label">规格(mm*mm)</label>
							<div class="col-sm-8">
								<input type="text" class="form-control" id="specification"
									name="specification" placeholder="请输入规格" />
							</div>
						</div>
						<div class="form-group col-lg-6">
							<label for="address" class="col-sm-2 control-label">送货地址</label>
							<div class="col-sm-8">
								<input type="text" class="form-control" id="address"
									name="address" placeholder="请输入送货地址" />
							</div>
						</div>
						<div class="form-group col-lg-6">
							<label for="m_count" class="col-sm-2 control-label">任务张数(张)</label>
							<div class="col-sm-8">
								<input type="text" class="form-control" id="m_count" value="0"
									name="m_count" placeholder="请输入张数" />
							</div>
						</div>
						<div class="form-group col-lg-6">
							<label for="m_weight" class="col-sm-2 control-label">订单重量(kg)</label>
							<div class="col-sm-8">
								<input type="text" class="form-control" id="m_weight" onFocus="getM_weight()"
									name="m_weight" placeholder="请输入订单重量" value="0.0" />
							</div>
						</div>
						<div class="form-group col-lg-6">
							<label for="m_num" class="col-sm-2 control-label">任务件数</label>
							<div class="col-sm-8">
								<input type="text" class="form-control" id="m_num" value="0"
									name="m_num" placeholder="请输入件数" />
							</div>
						</div>
						<div class="form-group col-lg-6">
							<label for="remark" class="col-sm-2 control-label">任务备注</label>
							<div class="col-sm-8">
								<input type="text" class="form-control" id="m_remark"
									name="m_remark" placeholder="请输入备注" />
							</div>
						</div>
						<div class="form-group" align="center">
							<div class="col-sm-12" align="center">
								<button type="button" class="btn btn-primary" onclick="saveMissionOrder()">保存</button>
								<button type="button" class="btn btn-danger" onclick="goback()">取消</button>
							</div>
						</div>
					</div>
				</form>
			</div>
			<div>
				<div class="hidden-sm hidden-xs" style="height: 160px;">&nbsp;</div>
			</div>
			
		</div>
	</div>


	<!-- jQuery -->
	<script src="<%=basePath%>js/jquery.min.js"></script>

	<!-- Bootstrap Core JavaScript -->
	<script src="<%=basePath%>js/bootstrap.min.js"></script>

	<!-- Metis Menu Plugin JavaScript -->
	<script src="<%=basePath%>js/metisMenu.min.js"></script>

	<!-- DataTables JavaScript -->
	<script src="<%=basePath%>js/jquery.dataTables.min.js"></script>
	<script src="<%=basePath%>js/dataTables.bootstrap.min.js"></script>

	<!-- Custom Theme JavaScript -->
	<script src="<%=basePath%>js/sb-admin-2.js"></script>
	<script type="text/javascript"
		src="<%=basePath%>js/jquery-1.8.3.min.js" charset="UTF-8"></script>
	<script type="text/javascript"
		src="<%=basePath%>js/bootstrap-datetimepicker.js" charset="UTF-8"></script>
	<script type="text/javascript"
		src="<%=basePath%>js/locales/bootstrap-datetimepicker.zh-CN.js"
		charset="UTF-8"></script>
	<script type="text/javascript"
		src="<%=basePath%>js/locales/bootstrap-datetimepicker.fr.js"
		charset="UTF-8"></script>
	<script type="text/javascript">
		$('.form_date').datetimepicker({
			language : 'zh-CN',
			weekStart : 1,
			todayBtn : 1,
			autoclose : 1,
			todayHighlight : 1,
			startView : 2,
			minView : 2,
			forceParse : 0
		});
		$('.form_date').datetimepicker({
			format : "dd MM yyyy",
			linkField : "m_date_mir",
			linkFormat : "yyyy-mm-dd"
		});
		
		function saveMissionOrder(){
			/* var grammage = $("#grammage").val();
			var gname = $("#gname").val();
			var pname = $("#pname").val();
			var specification = $("#specification").val();
			var address = $("#address").val();
			var m_count = $("#m_count").val();
			var m_weight = $("#m_weight").val();
			var m_num = $("#m_num").val();
			var m_remark = $("#m_remark").val().trim();
			alert(gname);
			alert(grammage); */
			$.ajax({
				type:"post",
				url:"<%=basePath%>saveMission1.action",
				/* data:{"grammage":grammage,"gname":gname,"pname":pname,"specification":specification,
					"address":address,"m_count":m_count}, */
				data:$('#myform').serialize(),
				success:function(data) {
					if(data.trim()=="ok")   
					{  
						if(confirm("创建成功，是否继续")){
							location.href="<%=basePath%>addMissionOrder.action";
						}			
					}else{
						alert("保存失败 ");
					}
				},
				error:function(){
					alert("保存失败 ");
				}
			});	
		}
		
		function toIndex(){
			location.href="<%=basePath%>index.action";
		}
		
		function getM_weight(){
			var specification = $("#specification").val().split('*');
			var grammage = $("#grammage").val()/1000;
			var m_count = $("#m_count").val();
			var m_weight_math = Number(grammage)*Number(m_count)*Number(specification[0])*Number(specification[1])/1000000;
			$("#m_weight").val(m_weight_math);
		}
		
		
		function goback(){
			location.href="<%=basePath%>index.action";
		}
		
	</script>

</body>

</html>
